package com.linux.huhx.thread2;

public class PrintThread implements Runnable {
    private boolean idPrint = true;

    public void setIdPrint(boolean idPrint) {
        this.idPrint = idPrint;
    }

    @Override
    public void run() {
        printStringMethod();
    }

    private void printStringMethod() {
        try {
            while (idPrint == true) {
                System.out.println("run thread " + Thread.currentThread().getName());
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
